﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Page最简单的分页.html</title>
    <script type="text/javascript" src="../Content/highlighter/scripts/shCore.js"></script>
    <script type="text/javascript" src="../Content/highlighter/scripts/shBrushCSharp.js"></script>
    <script type="text/javascript" src="../Content/highlighter/scripts/shBrushXml.js"></script>
    <link type="text/css" rel="stylesheet" href="../Content/highlighter/styles/shCoreDefault.css" />
    <script type="text/javascript">SyntaxHighlighter.all();</script>
</head>
<body>
    <h3>Page方法</h3>
    <p>
        Page(string sql,int ) 有两个参数 sql:sql查询语句  pageSize:每页显示行数
        <br />
        返回：行对象数组
        <br/>
    </p>
    1.
    <pre class="brush: csharp;">
    public void  Index()
    {
        //打开一个数据库链接
        Models.YMC.OpenConnection();
        var rows = Models.YMC.Page("SELECT * FROM user",2);
        //关闭数据库连接
        Models.YMC.CloseConnection();
        View("IndexController/Index.aspx");
    }
   </pre>
    2.使用分页控件NFinal/Controll/Navigator.ascx,将其拖入要使用的aspx页面即可
    <pre class="brush:html;">
        &lt;div>
            &lt;uc1:navigator runat="server" id="navigator" />
        &lt;/div>
    </pre>
    <p>
        3.模板会根据以上代码生成正确的执行代码，此处不再显示。可以参见此页有参数中的模板生成的代码
    </p>
</body>
</html>
